{extend name="platform/base" /}
{block name="resources"/}
<style>
.mlr15{
	margin:0;
}
.data-loading-eject-layer{
	width: 100%;
	height: 100%;
	position: fixed;
	top: 0;
	left: 0;
	z-index: 10000;
	background:rgba(0,0,0,0.4);
	display: none;
}	
.prompt_information{
	width: 200px;
	height: 200px;
	position: relative;
	margin:auto;
	background: #fff;
	top: 30%;
    box-shadow: 0 0 6px -1px #bbb;
    border-radius: 20px;
}
.prompt_information .load-icon{
	width: 150px;
	height: 150px;
	line-height: 200px;
	margin:0 auto;
	text-align: center;
	position:relative;
}
.prompt_information .load-icon i{
	color: #bbb;
    position: absolute;
    top: 30%;
    left: 26%;
    transform: translateX(-50%) translateY(-50%);
}
.prompt_information .information{
	height: 50px;
	text-align: center;
}
.progress_bar{
	width: 90%;
	margin: 5px auto;
	height: 5px;
	border:1px solid #ddd;
}
.progress_bar .speed_of_progress{
	width: 3%;
	height: 5px;
	background: #0689e1;
}
.btn-common-delete:hover{
	color: #fff;
}
</style>
{/block}
{block name="main"}
<section class="panel panel-default">
	<header class="panel-heading font-bold"> 清除缓存 </header>
	<div class="panel-body">
		<form class="form-horizontal">
			<div class="form-group">
				<label class="col-sm-2 control-label">表结构缓存</label>
				 <div class="col-md-4">
					  <label for="waptype1" class="radio-label"><input type="radio" value="1" name="tableCache" id="">是</label>
			      	  <label for="waptype2" class="radio-label"><input type="radio" value="0" name="tableCache" id="" checked="checked">否</label>
		 	     </div>
		 	     <p class="col-sm-4" style="width:100%;margin-left: 16.66%;margin-top: 10px;color: #BBB;">在版本升级或修改数据库表结构后必须清除该缓存</p>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			
			<div class="form-group">
				<label class="col-sm-2 control-label">命名空间缓存</label>
				 <div class="col-md-4">
					  <label for="waptype1" class="radio-label"><input type="radio" value="1" name="classCache" >是</label>
			      	  <label for="waptype2" class="radio-label"><input type="radio" value="0" name="classCache"  checked="checked">否</label>
		 	     </div>
		 	     <p class="col-sm-4" style="width:100%;margin-left: 16.66%;margin-top: 10px;color: #BBB;">在版本升级或修改类库文件后必须清除该缓存</p>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			
			<div class="form-group">
				<label class="col-sm-2 control-label">数据缓存</label>
				 <div class="col-md-4">
					  <label for="waptype1" class="radio-label"><input type="radio" value="1" name="dataCache" >是</label>
			      	  <label for="waptype2" class="radio-label"><input type="radio" value="0" name="dataCache" checked="checked">否</label>
		 	     </div>
		 	     <p class="col-sm-4" style="width:100%;margin-left: 16.66%;margin-top: 10px;color: #BBB;">在版本升级或数据更新后清除该缓存</p>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			
			<div class="form-group">
				<div class="col-sm-4 col-sm-offset-2">
					<a href="javascript:void(0);" onclick="setConfigAjax()" class="btn btn-primary">清除</a>
				</div>
			</div>
		</form>
	</div>
</section>

<!-- 更新遮罩层 -->
<div class="data-loading-eject-layer">
	<div class="prompt_information">
		<div class="load-icon"><i class="fa fa-refresh fa-spin fa-5x fa-fw"></i></div>
		<p class="information">正在清除中</p>
	</div>
</div>

<script>
function setConfigAjax(){
	var tableCache = $('[name="tableCache"]:checked').val();
	var classCache = $('[name="classCache"]:checked').val();
	var dataCache = $('[name="dataCache"]:checked').val();
 	if(tableCache == 0 && classCache == 0 && dataCache == 0) {
 		showMessage('error', '请选择要清除的缓存');
 		return;
 	}
	$.ajax({
		type:"post",
		url:"{:__URL('PLATFORM_MAIN/config/cacheConfig')}",
		data:{
			'tableCache' : tableCache,
			'classCache' : classCache,
			'dataCache' : dataCache,
		},
		beforeSend:function(){
			$(".data-loading-eject-layer").fadeIn();
		},
		success:function (data) {
			$(".data-loading-eject-layer").fadeOut();
			if (data["code"] > 0) {
				showMessage('success', data["message"],'{:__URL('PLATFORM_MAIN/config/cacheConfig')}');
			}else{
				showMessage('error', data["message"]);
			}
		}
	});
}
</script>
{/block}